package com.gxufl.console;

import java.util.List;
import java.util.Scanner;

import com.gxufl.entity.Notice;
import com.gxufl.entity.Room;
import com.gxufl.service.NoticeService;
import com.gxufl.service.RoomService;
import com.gxufl.util.BackException;
import com.gxufl.util.InputUtil;

public class RoomConsole {
	RoomService se=new RoomService();
//	public void showRoomList() throws BackException{
//		
//		String name = InputUtil.nextInput("请输入影厅名称");
//		List<Room> list = se.searchRoom(name);
//		// for打印输出
//		for (int i = 0, ii = list.size(); i < ii; i++) {
//			Room room = list.get(i);
//			System.out.println("影厅名称："+room.name+",座位数："+room.num);
//		}
//	}
	public void showRoomList(){
		String name = InputUtil.nextInput("请输入影厅名称");
		List<Room> list = se.searchRoom(name);
		// for打印输出
		for (int i = 0, ii = list.size(); i < ii; i++) {
			Room room = list.get(i);
			System.out.println("影厅名称："+room.name+",座位数："+room.num);
		}
	}
	/**
	 * 处理保存海报逻辑
	 */
//	public void saveRoom() throws BackException{
//		String name = InputUtil.nextInput("请输入影厅名称：");
//		Integer num = InputUtil.nextIntInput("请输入影厅座位数：");
//		Room room = new Room(num, name);
//		se.saveRoom(room);
//	}
	
	public void saveRoom(){
		String name = InputUtil.nextInput("请输入影厅名称：");
		Integer num = InputUtil.nextIntInput("请输入影厅座位数：");
		Room room = new Room(num, name);
		se.saveRoom(room);
	}
}
